Substitution system
Substitution system
by dividing a square into 9 subsquares
Enter subsubtitle here
Wolfgang Hitzl
31.12.2018
In[]:=
Definition how substitution is done
Definition how substitution is done
Enter subsection title here
Enter subsection title here
these definitions can easily be modified: simply try other matrices with values 1,2 or 3.
these definitions can easily be modified: simply try other matrices with values 1,2 or 3.
f:=ReplaceAll#,1->
,2
,3
&
2 | 2 | 2 |
2 | 2 | 2 |
2 | 2 | 2 |
2 | 1 | 2 |
1 | 2 | 1 |
2 | 1 | 2 |
1 | 3 | 1 |
3 | 1 | 3 |
1 | 3 | 1 |
the dimensions of the matrices can also be reduced, e.g.
the dimensions of the matrices can also be reduced, e.g.
(*f:=ReplaceAll#,1->
,2
,3
&*)
2 | 2 | 2 | 2 |
2 | 1 | 1 | 2 |
2 | 1 | 1 | 2 |
2 | 2 | 2 | 2 |
2 | 2 | 2 | 2 |
3 | 3 | 2 | 2 |
3 | 2 | 3 | 2 |
2 | 3 | 3 | 2 |
2 | 3 | 3 | 2 |
3 | 1 | 1 | 3 |
3 | 1 | 1 | 3 |
2 | 3 | 3 | 2 |
In[]:=
Flatten2D[list_]:=Apply[Join,Map[MapThread[Join,#]&,list]];system[n_,initial_]:=Nest[Flatten2D,Nest[f[#]&,initial,n],n-1];Illustration[n_,initial_]:=ArrayPlot[system[n,initial],ImageSizeMedium,ColorRules{1Lighter[Gray,0.5],2Darker[ColorData["Crayola"]["Mauvelous"],0.9],3Lighter[ColorData["Crayola"]["Maroon"],0.1]}];
In[]:=
Manipulate[Illustration[n,initial],{{initial,1,Style["Initial state",10,Bold]},{1,2,3},ControlTypeSetterBar,AppearanceTiny},{{n,3,Style["Iteration no.",10,Bold]},{1,2,3,4,5,6},ControlTypeSetterBar,AppearanceTiny}]
Out[]=